﻿namespace FasadPattern.Tests
{
    using System.Collections.Generic;
    using FasadPattern;
    using FasadPattern.Composits;
    using NUnit.Framework;

    [TestFixture]
    public class UT_PackEntityToFile
    {
        [Test]
        public void Pack()
        {
            ///packing
            Fasad fasad = new Fasad();
            fasad.PackEntityToFile(m_fileName, m_per);
            ///------
            string actual = fasad.GetFileContent();

            Assert.AreEqual(expected, actual);
        }

        private static Adress[] m_adresses = { new Adress(45666,"Brachiosaurus","Gorod","Street",34), 
                           new Adress(40099,"Amargasaurus","Gorod2","Stree sft",23),  
                           new Adress(65443,"Mamenchisaurus","Gorod3","Street 32",367),  };
        private static Contact[] m_contacts = { new Contact("09876543212","drf@mail.com"), 
                           new Contact("83261928373","sfgdfg@gmail.com"), 
                           new Contact("22363263845","dsrgdghbfgrf@mail.com") };
        private Person m_per = new Person(1, "Gregory", "House", 53, new List<Adress>(m_adresses), new List<Contact>(m_contacts));
        private string m_fileName = "fasad.txt";
        private string expected = "{ID:1, FirstName:\"Gregory\", LastName:\"House\", Age:53, [{Index:45666, Country:\"Brachiosaurus\", City:\"Gorod\", Street:\"Street\", HouseNumber:34}, {Index:40099, Country:\"Amargasaurus\", City:\"Gorod2\", Street:\"Stree sft\", HouseNumber:23}, {Index:65443, Country:\"Mamenchisaurus\", City:\"Gorod3\", Street:\"Street 32\", HouseNumber:367}], [{PhoneNumber:\"09876543212\", Email:\"drf@mail.com\"}, {PhoneNumber:\"83261928373\", Email:\"sfgdfg@gmail.com\"}, {PhoneNumber:\"22363263845\", Email:\"dsrgdghbfgrf@mail.com\"}]}";

    }
}
